<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机更换页面颜色</title>
</head>
<body>
    <script>
        function changeBackgroundColor() {
            var randomNumber = Math.random();
            var SUString = randomNumber.toString(16);
            var randomColor = '#' + SUString.charAt(6);
            document.body.style.backgroundColor = randomColor;
        }
        document.addEventListener('keydown', function(event) {
            if (event.key === 'f') {
                changeBackgroundColor();
            }
        });
    </script>
</body>
</html>